#include <iostream>
#include <cstring>

#define NAMESIZE 256

using namespace std;

class Person {
	private:
		int m_id;
		char m_name[NAMESIZE];
	public:
		Person(int id, const char *name);
		Person(const Person &p);
		~Person();
		void show();
		void setId(int id);
		void setName(const char *name);
};

Person::Person(int id, const char *name) : m_id(id)
{
	//m_id = id;
	strncpy(m_name, name, NAMESIZE);
}

Person::Person(const Person &p) : m_id(p.m_id)
{
	//m_id = p.m_id;
	strncpy(m_name, p.m_name, NAMESIZE);
}

Person::~Person()
{
	cout << "Bye, [" << m_id << "] " << m_name << "!" << endl;
}

void Person::show()
{
	cout << "Hello, [" << m_id << "] " << m_name << "!" << endl;
}

void Person::setId(int id)
{
	m_id = id;
}

void Person::setName(const char *name)
{
	strncpy(m_name, name, NAMESIZE);
}

int main(void)
{
	Person p1(101, "Alice");
	Person p2(p1);

	p2.setId(102);
	p1.setName("喵呜机");

	p1.show();
	p2.show();

	return 0;
}

